package com.cssw.fyzb.wap.controller;

import com.cssw.fyzb.base.web.context.UserContext;
import com.cssw.fyzb.base.web.domain.AjaxData;
import com.cssw.fyzb.wap.service.HelloService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Feng Chen
 */
@RestController
@RequestMapping("/test")
public class HelloController {

    @Autowired
    private HelloService helloService;

    @ApiOperation(value = "测试视频上传", response = AjaxData.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "title", value = "主题", paramType = "query", dataType = "string", required = true),
            @ApiImplicitParam(name = "media", value = "视频地址", paramType = "query", dataType = "string", required = true),
            @ApiImplicitParam(name = "cover", value = "视频封面", paramType = "query", dataType = "string", required = true),
            @ApiImplicitParam(name = "draft", value = "草稿 1-是,0-否", paramType = "query", dataType = "string", required = false),
            @ApiImplicitParam(name = "lat", value = "纬度", paramType = "query", dataType = "string", required = true),
            @ApiImplicitParam(name = "lng", value = "经度", paramType = "query", dataType = "string", required = true)
    })
    @RequestMapping(value = "/addLocalVideo", method = RequestMethod.POST)
    public AjaxData addLocalVideo(String title, String media, String cover, String draft, String lat, String lng) {
        return helloService.addLocalVideo(UserContext.get().getUserId(), title, media, cover, draft, lat, lng);
    }

}
